<?php
   header("Content-type:text/html;charset=utf-8");

   $mysqli = new mysqli("localhost","root","root","db_yuedu");

   // echo $mysqli->connect_errno;
   $sql = "select * from t_articles limit 10";
   $res = $mysqli->query($sql);
   for ($i = 0; $i < $res->num_rows;$i++){
     $data[] = $res->fetch_assoc();
   }
   print_r(json_encode($data));
?>